[struts 2] How do you iterate through a list of objects?

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-05-02T20:54:14Z Indexed on 2010/05/02 20:57 UTC
Read the original article Hit count: 241

Filed under:
|

I have a User class that has a String username in it. I have a list of users that I'm trying to display in a table using

                         <s:iterator value="users" id="list">
                                <tr>
                                    <td><s:property value="#list.username" /></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                         </s:iterator>

The rows are being displayed the right number of times, so it's iterating through my list properly. However, I don't know how to access the username property to display it. Obviously what I have above isn't correct... Any ideas?

© Stack Overflow or respective owner

Related posts about struts2

Related posts about iterator